package com.itqf.controller;

import com.itqf.annotation.JSONType;
import com.itqf.service.CategoryService;
import com.itqf.service.impl.CategoryServiceImpl;
import com.itqf.vo.R;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.sql.SQLException;

/**
 * projectName: gpshop
 *
 * @author: 赵伟风
 * time: 2021/7/22 14:52
 * description:
 */
@WebServlet("/category/*")
public class CategoryController extends BaseServlet {

    /**
     * 返回所有类别的JSON数据!
     * @param request
     * @param response
     * @return
     */
    @JSONType
    public R show(HttpServletRequest request, HttpServletResponse response) throws SQLException {

        //1.接收参数 没有参数

        //2.调用业务即可
        CategoryService categoryService = new CategoryServiceImpl();
        /**
         * 返回所有类别
         */
        R r = categoryService.findAll();

        //3.响应数据
        return r;
    }



}
